# 通过 pip install PyYAML==6.0.1 安装 PyYAML
import yaml

def write_yaml():
    with open("./data.yaml",encoding="utf-8",mode="a+") as f:


# 往 YAML 文件中写入数据
yaml.safe_dump(
    {"name": "test", "age": 18, "city": "Beijing"},
    open("data.yaml", "w"),
    allow_unicode=True,
    default_flow_style=False
)
yaml.safe_dump({"name": "test2", "age": 20, "city": "Shanghai"},open("data.yaml", "a"),
    allow_unicode=True,
    default_flow_style=False
)
